import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";

// https://vite.dev/config/
export default defineConfig({
  plugins: [react()],
  base: "./",
  server: {
    //代理服务器，解决跨域问题
    port: 3000,
    proxy: {
      //统一设置请求地址，并做出处理
      "/api": {
        //'/api'与axios疯狂的baseUrl对齐
        target: "", //请求地址
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, ""),
      },
    },
  },
});
